﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GreenXi.Help.Can
{
    /// <summary>
    /// Can的基础类
    /// </summary>
    public class CanMessage
    {
        public static class Messages
        {
            /// <summary>
            /// 控制指令
            /// </summary>
            public static string Controlword = "2B 40 60 00 ";
            /// <summary>
            /// 模式设定
            /// </summary>
            public static string ModesOperation = "2F 60 60 00 "; 
            
           

            /// <summary>
            /// 获取位移
            /// </summary>
            public static string Displacement = "40 64 60 00 ";

            /// <summary>
            /// 设置目标位置
            /// </summary>
            public static string TargetPosition = "23 7A 60 00 ";

            /// <summary>
            /// 速度模式设置速度
            /// </summary>
            public static string SpeedModeSpeed = "23 FF 60 00 ";

            /// <summary>
            /// 位移模式设置速度
            /// </summary>
            public static string PositionModeSpeed = "23 81 60 00 ";


    
        }


        public static class  MessagesCode
        {

            public static string Zero = "00 00 00 00";
            #region Controlword
            /// <summary>
            /// 关闭
            /// </summary>
            public static string Shutdown = Messages.Controlword + "06 00 00 00";
            /// <summary>
            /// 接通
            /// </summary>
            public static string SwitchOn = Messages.Controlword+ "07 00 00 00";

           /// <summary>
           /// ServoOn
           /// </summary>
            public static string ServoOn = Messages.Controlword+"0F 00 00 00";

           /// <summary>
           /// 触发
           /// </summary>
          public static string RisingEdge = Messages.Controlword + "1F 00 00 00";

         
            #endregion

            #region ModesOperation
            /// <summary>
            /// 速度模式
            /// </summary>
            public static string SpeedMode = Messages.ModesOperation + "03 00 00 00";
            

            /// <summary>
            /// 位移模式
            /// </summary>
            public static string DisplacementMode = Messages.ModesOperation + "01 00 00 00";


            /// <summary>
            /// 位置模式停止
            /// </summary>
            public static string DisplacementModeStop = Messages.Controlword + "02 60 00 00";

            /// <summary>
            /// 复归模式
            /// </summary>
            public static string HomingMode = Messages.ModesOperation + "06 00 00 00";

            
            /// <summary>
            /// 原点复归
            /// </summary>
            public static string ReturnZeroMode = "2F 98 60 00 0B 00 00 00";

            /// <summary>
            /// 设定寻找原点开关的速度
            /// </summary>
            public static string ReturnZeroSpeed = "23 99 60 01 08 07 00 00";

            /// <summary>
            /// 设定寻找Z PULSE速度
            /// </summary>
            public static string ReturnZpulseSpeed = "23 99 60 02 B4 00 00 00";
            #endregion

            /// <summary>
            /// 获取状态
            /// </summary>
            public static string Status = "40 01 20 00 "+ Zero;

            ///// <summary>
            ///// 复位_低
            ///// </summary>
            //public static string ResetLow = "2B 40 60 00 00 00 00 00";

            /// <summary>
            /// 复位_高
            /// </summary>
            public static string ResetHight = "2B 01 20 00 00 00 00 00";


        }
    }
}
